// 发起请求时全屏遮罩，请求结束后关闭
//在webservice中引用
import {Loading} from 'element-ui';

let loading;

//存储请求个数
let requestCount = 0;

//开始
export function showFullScreenLoading() {
    if (requestCount === 0) {
        // 初始化loading
        loading = Loading.service({
            target: 'document',
            fullscreen: true,
            lock: true,
            text: '数据加载中...',
            background: 'rgba(255, 255, 255, 0.8)',
            spinner: "el-icon-loading"
        })
    }
    requestCount++;
}

//结束
export function hideFullScreenLoading() {
    if (requestCount <= 0)
        return;
    requestCount--;
    if (requestCount === 0) {
        // 关闭loading
        loading.close()
    }
}



